//
//  UIWebView+WebViewLoading.m
//  GaojiaoSNS
//
//  Created by Ruijie on 13-11-5.
//  Copyright (c) 2013年 EbolaPro. All rights reserved.
//

#import "UIWebView+WebViewLoading.h"
@implementation UIWebView (WebViewLoading)
- (void)webViewPrepareLoading
{
    self.backgroundColor = [UIColor whiteColor];
    UIImageView *loadingView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kDeviceWidth, kDeviceWidth)];
    loadingView.image=[UIImage imageNamed:@"loadingweb.png"];
    [self addSubview:loadingView];
    [self exchangeSubviewAtIndex:1 withSubviewAtIndex:0];
    [[self.subviews objectAtIndex:1] setAlpha:1.0];
}

- (void)webViewBegainLoading
{
    [[self.subviews objectAtIndex:1] setAlpha:0.0];
}

- (void)webViewFinishLoading
{
    [UIView animateWithDuration:0.8 animations:^{
        [[self.subviews objectAtIndex:1] setAlpha:1.0];
    }];
}

- (void)webViewFailLoading
{
    [UIView animateWithDuration:0.8 animations:^{
        [[self.subviews objectAtIndex:1] setAlpha:1.0];
    }];
//    [SVProgressHUD showErrorWithStatus:@"加载失败"];
}

@end
